<!-- 使用 type="home" 属性设置首页 -->
<route type="home" lang="json5">
{
  style: { navigationBarTitleText: '%pages.index.index.title%' },
  name: 'home'
}
</route>

<template>
  <view class="min-h-100vh">
    <Home v-if="tabbar === 0" />
    <My v-if="tabbar === 2" />
    <uv-tabbar  :value="tabbar" @change="index=>tabbar = index">
      <uv-tabbar-item text="首页" icon="home"></uv-tabbar-item>
      <uv-tabbar-item text="Ai" icon="chat"></uv-tabbar-item>
      <uv-tabbar-item text="我的" icon="account"></uv-tabbar-item>
    </uv-tabbar>
  </view>
</template>

<script setup lang="ts">
import { fetchLogin } from '@/service';
import Home from '@/pages/components/home/index.vue';
import My from '@/pages/components/my/index.vue';
const tabbar = ref(0);

const userInfo = ref();

onMounted(async () => {
  const { data, error } = await fetchLogin({ username: 'admin', password: '123456' }, { custom: { mock: true } });
  if (!error) {
    userInfo.value = data;
    console.log(userInfo.value);
  }
});
</script>
<style lang="scss"></style>
